package src.Thirteen;

import javax.swing.*;
import java.awt.*;

public class BorderLayPosition extends JFrame {

    String[] border = {BorderLayout.CENTER,BorderLayout.NORTH,BorderLayout.SOUTH,BorderLayout.WEST,BorderLayout.EAST};
    String[] buttonName = {"center button","north button","south button","west button","east button"};
    public BorderLayPosition(){
        setTitle("这个窗体使用边界管理器");
        Container c = getContentPane();
        setLayout(new BorderLayout());
        for (int i = 0; i < border.length; i++) {
            c.add(border[i],new JButton(buttonName[i]));
        }
        setSize(350,200);
        setVisible(true);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    }

    public static void main(String[] args) {
        new BorderLayPosition();
    }
}
